<?php

namespace App\Models\Admin\Conf;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class SettingOption
 * @package App\Models\Admin\Conf
 * @version August 2, 2017, 12:30 pm UTC
 */
class SettingOption extends Model
{
    use SoftDeletes;

    public $table = 'setting_options';
    

    protected $dates = ['deleted_at'];


    public $fillable = [
        'name',
        'alias',
        'value',
        'description',
        'listorder'
    ];

    /**
     * The attributes that should be casted to native types.
     *
     * @var array
     */
    protected $casts = [
        'name' => 'string',
        'alias' => 'string',
        'value' => 'string',
        'description' => 'string',
        'listorder' => 'integer'
    ];

    /**
     * Validation rules
     *
     * @var array
     */
    public static $rules = [
        'name' => 'required|max:200',
        'alias' => 'required|max:200',
        'value' => 'required|max:200',
        'listorder' => 'required'
    ];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     **/
    public function setting()
    {
        return $this->hasOne(\App\Models\Admin\Conf\Setting::class, 'setting_option_id', 'id');
    }
}
